package com.androidx.p013lv.mine.activity;

import android.widget.TextView;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter;
import com.androidx.p013lv.base.p015ui.BaseActivity;
import com.androidx.p013lv.mine.C1207R;
import com.androidx.p013lv.mine.databinding.ActivityMineBuyVideoLayoutBinding;
import com.androidx.p013lv.mine.fragment.BuyVideoFragment;
import com.androidx.p013lv.mine.fragment.SmallVideoFragment;
import com.google.android.material.tabs.TabLayout;
import com.gyf.immersionbar.ImmersionBar;
import p000a.shuyu.p005a.GSYVideoManager;

/* renamed from: com.androidx.lv.mine.activity.MineBuyVideoActivity */
public class MineBuyVideoActivity extends BaseActivity<ActivityMineBuyVideoLayoutBinding> {
    /* access modifiers changed from: protected */
    @Override // com.androidx.p013lv.base.p015ui.BaseActivity
    public void initImmersionBar() {
        super.initImmersionBar();
        ImmersionBar.with(this).titleBar(((ActivityMineBuyVideoLayoutBinding) this.binding).toolbar).statusBarDarkFont(false).init();
    }

    @Override // com.androidx.p013lv.base.p015ui.BaseActivity
    public int setLayout() {
        return C1207R.C1212layout.activity_mine_buy_video_layout;
    }

    /* access modifiers changed from: protected */
    @Override // com.androidx.p013lv.base.p015ui.BaseActivity
    public void initView() {
        super.initView();
        ((ActivityMineBuyVideoLayoutBinding) this.binding).setClick(new OnClick());
        ((ActivityMineBuyVideoLayoutBinding) this.binding).viewPager.setAdapter(new Adapter(getSupportFragmentManager()));
        ((ActivityMineBuyVideoLayoutBinding) this.binding).tabLayout.addOnTabSelectedListener((TabLayout.OnTabSelectedListener) new TabLayout.OnTabSelectedListener() {
            /* class com.androidx.p013lv.mine.activity.MineBuyVideoActivity.C12481 */

            @Override // com.google.android.material.tabs.TabLayout.BaseOnTabSelectedListener
            public void onTabReselected(TabLayout.Tab tab) {
            }

            @Override // com.google.android.material.tabs.TabLayout.BaseOnTabSelectedListener
            public void onTabSelected(TabLayout.Tab tab) {
                MineBuyVideoActivity.this.changeTabTextView(tab, true);
            }

            @Override // com.google.android.material.tabs.TabLayout.BaseOnTabSelectedListener
            public void onTabUnselected(TabLayout.Tab tab) {
                MineBuyVideoActivity.this.changeTabTextView(tab, false);
            }
        });
        ((ActivityMineBuyVideoLayoutBinding) this.binding).tabLayout.setupWithViewPager(((ActivityMineBuyVideoLayoutBinding) this.binding).viewPager);
    }

    public void changeTabTextView(TabLayout.Tab tab, boolean z) {
        if (tab.getCustomView() == null) {
            tab.setCustomView(C1207R.C1212layout.attention_tab_layout_text);
        }
        TextView textView = (TextView) tab.getCustomView().findViewById(16908308);
        if (z) {
            textView.setTextAppearance(getActivity(), C1207R.C1214style.TabLayoutCollectTextSize);
        } else {
            textView.setTextAppearance(getActivity(), C1207R.C1214style.TabLayoutCollectNormalTextSize);
        }
    }

    @Override // androidx.activity.ComponentActivity, com.androidx.p013lv.base.p015ui.BaseActivity
    public void onBackPressed() {
        if (GSYVideoManager.isFullState(this)) {
            GSYVideoManager.backFromWindowFull(getActivity());
        } else {
            super.onBackPressed();
        }
    }

    /* renamed from: com.androidx.lv.mine.activity.MineBuyVideoActivity$Adapter */
    public static class Adapter extends FragmentStatePagerAdapter {
        @Override // androidx.viewpager.widget.PagerAdapter
        public int getCount() {
            return 2;
        }

        @Override // androidx.viewpager.widget.PagerAdapter
        public CharSequence getPageTitle(int i) {
            return i == 0 ? "視頻" : "小視頻";
        }

        Adapter(FragmentManager fragmentManager) {
            super(fragmentManager, 1);
        }

        @Override // androidx.fragment.app.FragmentStatePagerAdapter
        public Fragment getItem(int i) {
            if (i == 0) {
                return BuyVideoFragment.newInstance();
            }
            return SmallVideoFragment.newInstance(1);
        }
    }

    /* renamed from: com.androidx.lv.mine.activity.MineBuyVideoActivity$OnClick */
    public class OnClick {
        public OnClick() {
        }

        public void btnBack() {
            MineBuyVideoActivity.this.finish();
        }
    }
}
